<template>
  <div class="projectManage" v-if="$route.name === '列表控件'">
    <a-row :gutter="16">
      <a-col class="pageRow"> <!--  :span="19" -->
        <div class="tableBox">
          <div class="domTtile">{{$t('projectList.title')}}</div>
          <div class="btn-input">
            <div class="btnBox">
              <a-button type="primary" @click="createProject" :disabled="!hasPermission">{{$t('projectList.create')}}</a-button>
              <a-button type="primary" @click="exportBtn" :loading="exportBtnStatus">{{$t('projectList.export')}}</a-button>
              <a-button @click="attentionChange(true)" v-if="!cancelAttentionVisible" :disabled="hasSelectTableData.length === 0">{{$t('projectList.follow')}}</a-button>
              <a-button @click="attentionChange(false)" v-if="cancelAttentionVisible" :disabled="hasSelectTableData.length === 0">{{$t('projectList.cancelFollow')}}</a-button>
              <a-tooltip placement="top">
                <template slot="title">
                  <span>刷新</span>
                </template>
                <a-button icon="redo" shape="circle" @click="refreshTable" style="width: 32px"></a-button>
              </a-tooltip>
            </div>
            <global-search ref="globalSearch" :searchTableData="searchData" :searchValueSave="searchValueSave" @onSearch="onSearch"></global-search>
          </div>
          <div class="tabBox">
            <tabs :defaultTagId="defaultTagId" :tabPaneData="tabPaneData" @change="callback" @tabOnContextMenu="tabOnContextMenu" @addTab="addTab"></tabs>
            <a-menu class="menustyle" :style="menuStyle" v-if="menuVisible">
              <a-menu-item>
                <a @click="tabReName()">编辑</a>
              </a-menu-item>
              <a-menu-item>
                <a @click="tabDelete()" class="red">删除</a>
              </a-menu-item>
            </a-menu>
          </div>
          <div class="tableItem">
            <common-table
              ref="table"
              :columns="columns"
              :tableData="tableData"
              :selectType="'checkbox'"
              :data-row-key="'oid'"
              :defaultTagId="defaultTagId"
              :isRowsSelectVisible="isRowsSelectVisible"
              :loadVisible="loadVisible"
              :hasAttention="hasAttention"
              :this-table-name="'项目列表'"
              :this-table-header-data="thisTableHeaderData"
              :this-table-header-data-middel="thisTableHeaderDataMiddel"
              :filterData="filterDataTable"
              @filterTable="filterTable"
              @routerPage="routerPage"
              @selectedRows="selectedRows"
            ></common-table>
          </div>
        </div>
      </a-col>
    </a-row>
    
    <!-- 添加tab抽屉@addTabTableRowSelect="addTabTableRowSelect" :tabOpenType="tabOpenType" :editTabProjectList="editTabProjectList" :addTabTableData="drawTable"-->
    <add-tab-project 
      ref='addTab'
      :addTabDrawerVisible="addTabDrawerVisible" 
      :addTabColumns="columns"
      @drawClose="drawClose"
      @drawConfirm="drawConfirm"
      :projectPermissionDataOid="projectPermissionDataOid"
    ></add-tab-project>
    <!-- 临界值弹框 -->
    <!-- <set-critical :criticalValueVsisible="criticalValueVsisible" @submitCritical="submitCritical" @valueCancel="valueCancel"></set-critical> -->
  </div>
  <router-view v-else class="createProject"></router-view>
</template>
<script>

import { listColumns, listContent } from "@/json/projectList.js"

import globalSearch from "@/components/common/globalSearch"
import commonTable from "@/components/common/commonTable";
import addTabProject from "./modules/addTabProject.vue";
// import setCritical from "./modules/setCritical.vue";
// import productTotal from "./modules/productTotal"
import tabs from "@/components/tabs/tabs"
import {
  // exportList,
  getProjectAttribute, 
  getProjectList, 
  getProjectCaches, 
  getProjectTags, 
  addProjectTags, 
  deletProjectTags, 
  getNewTagsTable,
  getAttentionsData,
  addAttentionData,
  editUserTags,
  // myAppPermission,
} from "@/api/projectManage.js"
import { getCustomizeHeaders } from '@/api/middleGround'
// import { saveFile } from '@/utils/util'
import { closeSingleTabs } from '@/api/common'
let userinfo = JSON.parse(sessionStorage.getItem('userInfo'))
import _ from 'lodash'
let userInfo = userinfo
let tabArr = [ // 标签数据
  {tagName: '全部', tagEnName: 'All', tagId: 'ALL'},
  {tagName: '我负责的', tagEnName: 'My responsible project', tagId: 'MANAGER'},
  {tagName: '我参与的', tagEnName: 'I participate in', tagId: 'JOIN'},
  {tagName: '我关注的', tagEnName: 'I focus on', tagId: 'ATTENTION'},
]
export default {
  name: "projectManage",
  components: {
    globalSearch,
    commonTable,
    addTabProject,
    tabs
  },
  data() {
    return {
      
      searchData: [], //搜索数据
      searchValueSave:'',
      exportBtnStatus: false,
      cancelAttentionVisible: false, // 取消关注按钮
      /**tab操作参数 */
      defaultTagId: 'ALL',
      addTabDrawerVisible: false, // 添加标签的抽屉显隐
      tabPaneData: [], // 标签数据
      menuVisible: false, // 标签右键menu显隐
      menuStyle: { // 标签右键样式
        position: "absolute",
        top: "0",
        left: "0",
        zIndex: 100,
        borderRadius: "5px",
        border: "1px solid #eee",
        boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
      },
      rightTabTitle: '', // 鼠标右键后记录下当前右键内容
      /**表格操作参数 */
      isRowsSelectVisible: true, // 是否显示表格的选择列
      columns: [],
      tableData: [
        // {}
      ],
      loadVisible: false,
      // healthStatusImg: '', // 健康状态图片
      healthStatusImgObj: { // 健康状态图片对象
        'green': require('@/assets/manageMain/green.svg'),
        'yellow': require('@/assets/manageMain/yellow.svg'),
        'red': require('@/assets/manageMain/red.svg'),
        'gray': require('@/assets/manageMain/gray.svg'),
      },
      hasSelectTableData: [], // 表格已选中数据
      hasAttention: [], // 已关注数据
      thisTableHeaderData: [],//当前表格所有表头数据
      thisTableHeaderDataMiddel: [],//当前表格存在中台的表头数据
      /**设置临界值参数 */
      criticalValueVsisible: false, // 设置临界弹框显隐
      hasPermission: true, // 是否有权限
      /** 右下角表格 */
      statisticalData: [],
      filterData: {}, // 所有筛选条件
      filterDataTable: {}, // 当前标签页对应筛选条件
      /**记录选中tab */
      // projectTabData: sessionStorage.getItem('projectTabData'),
      /**记录下列表数据 */
      projectPermissionDataOid: [],
    };
  },
  computed: {
    loadNum() {
      return this.$store.state.loadTable.num
    },//vuex数据，表头设置点击“确定”，刷新数据
  },
  watch: {
    loadNum(value) {
      if (this.$store.state.loadTable.tableName === '项目列表') {
        this.initData()
      }
    },
    $route(val, oldVal) {
      if (oldVal.path === "/projectManage/createProject") {
        this.initData()
      } 
      else if (oldVal.path === "/homePage") {
        this.defaultTagId = 'ALL'
        this.initData()
      }
    },
    defaultTagId(val) {
      this.filterDataTable = this.filterData[this.defaultTagId] || {}
      // this.$refs.globalSearch.searchValue = this.searchInfo[val]
    }
  },
  activated() {
    this.$refs.globalSearch.searchValue = this.searchValueSave // 缓存页面后跳转保留搜索条件
    if (this.$store.state.commonData.savePageData) {
      this.$refs.table.pagination.current = this.$store.state.commonData.savePageData
    } 
  },
  mounted() {
    let filterData = JSON.parse(sessionStorage.getItem('filterData') || '{}').projectManage
    if (filterData) {
      this.filterData = filterData
      this.filterDataTable = this.filterData[this.defaultTagId] || {}
    }
    this.defaultTagId = this.projectTabData ? this.projectTabData : 'ALL'
    this.initData()
  },
  methods: {
    // 初始化数据
    async initData() {
      await this.getAttentionData()
      this.getMiddleHeaderData('项目列表')
      // this.getTableDataParams('ALL')
      this.getAddContent()
      // this.getAppPermission()
    },
    /**刷新 */
    refreshTable() {
      this.defaultTagId = 'ALL'
      this.$refs.table.pagination.current = 1
      this.initData()
    },
    exportBtn() {
      this.exportBtnStatus = true
      this.$message.success('导出成功')
      this.exportBtnStatus = false
    //   this.exportBtnStatus = true
    //   let arr = []
    //   this.columns.map((item, index) => {
    //     if (item.dataIndex !== 'setting') {
    //       arr.push({
    //         name: item.name,
    //         title: item.title,
    //         num: index + 1
    //       })
    //     }
    //   })
    //   arr.forEach(col => {
    //      this.tableData.forEach(item => {
    //        item[col.name] = ((item[col.name]??'') !== '') ? item[col.name] : ''
    //      })
    //   })
    //   let data = {
    //     "titles" : arr,
    //     "projects": this.tableData
    //   }
    //   exportList(data).then(res => {
    //     if (res && res.status === 200) {
    //       const blob = new Blob([res.data], {type: 'application/octet-stream'})
    //       saveFile(blob, '项目列表.xlsx')
    //       this.exportBtnStatus = false
    //     } else {
    //       this.exportBtnStatus = false
    //       this.$message.warn('导出异常')
    //     }
    //   })
    },
    // 全局搜索
    onSearch(tableVal, searchValue) {
      this.searchValueSave = searchValue;
      if (!searchValue) {
        // 当传过来的数据为空，并且输入条件为空时，重新调用
        this.tableData = this.searchData
      } else {
        this.tableData = tableVal
        // this.searchInfoTable[this.defaultTagId] = tableVal
      }
    },
    filterTable(filterData) {
      this.filterData[this.defaultTagId] = filterData
      let filterDataSession = JSON.parse(sessionStorage.getItem('filterData') || '{}')
      filterDataSession.projectManage = this.filterData
      sessionStorage.setItem('filterData', JSON.stringify(filterDataSession))
    },
    // 获取关注数据
    getAttentionData(key) {
      this.loadVisible = true
      this.tableData = []
      let data = {
        userId: userInfo.loginName,
      }
      getAttentionsData(data).then(res => {
        if (res.status === 200) {
          if (res.data && res.data.projectList) {
            let arr = res.data.projectList.split(',')
            if (key === 'ATTENTION') {
              this.hasAttention = []
              this.getTableData(arr)
            } else {
              this.hasAttention = res.data.projectList.split(',')
            }
          } else {
            this.loadVisible = false
            // this.tableData = []
          }
        } else {
          this.$message.error('获取关注数据失败')
        }
      })
    },
    // tab切换
    callback(key) {
      this.getTableData(key)

      // console.log(key, 282);
      // this.$refs.globalSearch.searchValue = ""
      // this.loadVisible = true
      // this.defaultTagId = key
      // this.cancelAttentionVisible = false
      // this.$refs.table.selectedRowKeys = [] // 讲选中的置空
      // this.$refs.table.pagination.current = 1
      // this.hasSelectTableData = [] // 置空选择的数据
      // /*判断在当前标签下是否有表格数据*/
      // // if (this.searchInfoTable[this.defaultTagId] && this.searchInfoTable[this.defaultTagId].length > 0) {
      // //   this.tableData = this.searchInfoTable[this.defaultTagId]
      // //   this.loadVisible = false
      // //   return
      // // }
      // // 切换的时候首先获取关注的项目接口
      // let data = {
      //   userId: userInfo.loginName,
      // }
      // getAttentionsData(data).then(res => {
      //   if (res && res.status === 200) {
      //     if (res.data && res.data.projectList) {
      //       this.hasAttention = res.data.projectList.split(',')
      //     } else {
      //       this.hasAttention = []
      //     }
      //     this.$nextTick(() => {
      //       if (key === 'ALL' || key === 'MANAGER' || key === 'JOIN') {
      //         this.getTableDataParams(key)
      //       } else if (key === 'ATTENTION') {
      //         this.getAttentionData(key)
      //         this.cancelAttentionVisible = true
      //       } else {
      //         this.tableData = []
      //         let keyArr = this.tabPaneData.filter(v => {
      //           return key === v.tagId
      //         })
      //         this.getNewTabTableData(keyArr[0])
      //       }
      //     })
      //   }
      // })
    },
    // prodectTotalChange(key) {
    //   if (key === 'ALL' || key === 'MANAGER' || key === 'JOIN') {
    //     this.getTableDataParams(key, false, true)
    //   } else if (key === 'ATTENTION') {
    //     this.getAttentionData(key, false, true)
    //     this.cancelAttentionVisible = true
    //   } else {
    //     this.tableData = []
    //     let keyArr = this.tabPaneData.filter(v => {
    //       return key === v.tagId
    //     })
    //     this.getNewTabTableData(keyArr[0], false, true)
    //   }
    // },
    // 获取标签
    getAddContent(x) {
      let that = this
      let data = {
        userId: userInfo.loginName,
      }
      getProjectTags(data).then(res => {
        if (res && res.status == 200) {
          if (res.data && res.data.tagList && res.data.tagList.length > 0) {
            that.tabPaneData = tabArr.concat(res.data.tagList)
            that.tabPaneData.forEach(m => {
              if (!m['tagEnName']) {
                that.$set(m, 'tagEnName', m['tagName'])
              }
            })
            console.log(that.tabPaneData, 388)
          } else {
            that.tabPaneData = tabArr
          }
          if (x) {
            that.defaultTagId = that.tabPaneData[x-1].tagId
            that.callback(that.defaultTagId)
          }
        }
      }).catch(error => {
        that.tabPaneData = tabArr
      })
    },
    // 获取新建标签表格数据
    getNewTabTableData(o) {
      let data = {
        tagId: o.tagId,
        tabName: o.tabName,
        userId: userInfo.loginName,
      }
      getNewTagsTable(data).then(res => {
        if (res.status === 200) {
          if (res.data && res.data.projectList) {
            let arr = res.data.projectList.split(',')
            this.getTableData(arr)
          } else {
            this.tableData = []
          }
        } else {
          this.$message.error('请求失败')
        }
      })
    },
    // tab右键
    tabOnContextMenu(e) {
      this.rightTabTitle = e.path[0].innerText
      if (this.rightTabTitle !== '全部' && this.rightTabTitle !== '我负责的' && this.rightTabTitle !== '我参与的' && this.rightTabTitle !== '我关注的'  ) {
        this.menuVisible = true;
        // this.menuStyle.top = e.clientY + "px";
        this.menuStyle.top = '118px'
        this.menuStyle.left = e.clientX - 200 + "px"
        document.addEventListener("click", this.cancelClick);
      } else {
        this.menuVisible = false;
      }
    },
    //取消右键菜单
    cancelClick() {
      this.menuVisible = false;
      document.body.removeEventListener("click", this.cancelClick);
    },
    // 添加自定义标签
    addTab() {
      this.addTabDrawerVisible = true
    },
    drawClose() {
      this.addTabDrawerVisible = false
    },
    drawConfirm(val, id, pro) {
      let arr = this.tabPaneData.filter(v => v.tagName === val)
      /* 新增时-->标签名已存在，直接判断arr长度；修改时--> 根据传过来的ID不等于当前编辑的id */
      if (arr.length > 0) {
        if (id !== arr[0].tagId ) {
          this.$message.warn('该名称已存在！')
        } else {
          this.editPrijectTag(val, id, pro)
          this.$refs.addTab.tabName = ''
          this.$refs.addTab.tagIds = null
          this.addTabDrawerVisible = false
        }
      } else {
        if (!id) {
          this.addTabPaneData(val, pro)
        } else {
          this.editPrijectTag(val, id, pro)
        }
        this.$refs.addTab.tabName = ''
        this.$refs.addTab.tagIds = null
        this.addTabDrawerVisible = false
      }
      
    },
    // 添加tab
    addTabPaneData(val, pro) {
      let data = {
        "projectList": pro,
        "tagName": val,
        "userId": userInfo.loginName
      }
      addProjectTags(data).then(res => {
        if (res.status === 200) {
          this.getAddContent()
        } else {
          this.$message.error('添加失败')
        }
      })
    },
    // 重命名
    tabReName() {
      this.addTabDrawerVisible = true
      let tagInfo = this.tabPaneData.filter(v => {
        return this.rightTabTitle === v.tagName
      })
      this.$refs.addTab.tabName = this.rightTabTitle
      this.$refs.addTab.tagIds = tagInfo[0].tagId
    },
    // 编辑tab
    editPrijectTag(val, id, pro) {
      let paramsData = {
        "projectList": pro,
        "tagId": id,
        "tagName": val,
        "userId": userInfo.loginName
      }
      editUserTags(paramsData).then(res => {
        if (res.status === 200) {
          if (res.data) {
            this.tabPaneData.map(item => {
              if (item.tagId === res.data.tagId) {
                item.tagName = res.data.tagName
              }
            })
            this.$message.success('修改成功')
            /*修改成功过后判断页面是否在当前tab下面*/
            if (this.defaultTagId === id) {
              this.tableData = []
              let keyArr = this.tabPaneData.filter(v => {
                return id === v.tagId
              })
              this.getNewTabTableData(keyArr[0])
            }
          }
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    // 删除tab
    tabDelete() {
      let tagInfo = this.tabPaneData.filter(v => {
        return this.rightTabTitle === v.tagName
      })
      /*判断删除的是不是在当前的tab页签*/
      let idx = null
      let parmasId = null
      if (tagInfo.length > 0) {
        if (this.defaultTagId === tagInfo[0].tagId) {
          this.tabPaneData.forEach((v, i) => {
            if (this.rightTabTitle === v.tagName) {
              idx = i
            }
          })
        }
        parmasId = tagInfo[0].tagId
      }
      let params = {
        tagId: parmasId,
      }
      deletProjectTags(params).then(res => {
        if (res.status == 200) {
          this.getAddContent(idx)
        }
      })
    },
    /*----获取表头，首先去中台获取*/
    getMiddleHeaderData(tableName) {
      this.getColumns([])
      //获取中台接口
      // let middleParms = {
      //   "tableName": tableName,
      //   "userId": userInfo.loginName
      // }
      // getCustomizeHeaders(middleParms).then(res => {
      //   if (res.status === 200 && res.data) {
      //     let middleHeadersDataOld = res.data.labelList
      //     if (middleHeadersDataOld.length > 0) {
      //       this.thisTableHeaderDataMiddel = middleHeadersDataOld.split(',')
      //       this.getColumns(this.thisTableHeaderDataMiddel)
      //     } else {
      //       this.getColumns([])
      //     }
      //   } else {
      //     this.thisTableHeaderDataMiddel = []
      //   }
      // })
    },
    // 1.获取表头
    getColumns(headersData) {
      // let params = {
      //   type: "com.pisx.pmgt.project.PIProject"
      // }
      // getProjectAttribute(params).then(res => {
        // if (res && res.status === 200) {
          setTimeout(() => {
            if (listColumns.success) {
              this.columns = [];
              // if (res.data && res.data.data && res.data.data.length > 0) { 
                let dataArr = listColumns.data
                this.thisTableHeaderData = dataArr;//所有表格头数据
                // 过滤掉设置项
                dataArr = dataArr.filter(e => {
                  return e.dataIndex !== "setting";
                });
                let columnData = dataArr;
                columnData.forEach((item, index) => {
                  // 项目名称
                  if (item.name === "projectName") {
                    item.scopedSlots = { 
                      customRender: "name",
                      filterDropdown: "filterDropdown",
                      filterIcon: "filterIcon", 
                    };
                  } else if (item.name === "healthStatus") {
                    item.scopedSlots = { 
                      filterDropdown: "filterDropdown",
                      filterIcon: "filterIcon",
                      customRender: "img",
                    };
                  } else {
                    item.scopedSlots = {
                      filterDropdown: "filterDropdown",
                      filterIcon: "filterIcon",
                      customRender: "customRender"
                    };
                  }
                  item.enName = item.name
                  item.name = item.name.toLowerCase()
                });
                // 处理数据
                let arrNew = []
                if (headersData.length > 0) {
                  arrNew = _.filter(columnData, function (o) {
                    return headersData.indexOf(o.displayName) !== -1;
                  })
                  arrNew = _.sortBy(arrNew, (rec) => {
                    return headersData.indexOf(rec.displayName)
                  })
                } else {
                  arrNew = columnData
                }
                arrNew.push({
                  dataIndex: "setting",
                  fixed: "right",
                  width: 40,
                  slots: { title: "customTitle" }
                });
                this.columns = arrNew;
                this.getTableDataParams('ALL')
              // } else {
              //   this.thisTableHeaderData = []
              // }
            }
          }, 1000);
          
        // } else {
        //   this.$message.error('获取表头失败')
        // }
      // }).catch(error => {
      //   this.isRowsSelectVisible = false
      //   this.$message.error('获取表头异常')
      // })
    },
    // 2.获取数据
    getTableDataParams(tabType) {
      // sessionStorage.setItem('projectTabData', tabType)
      // console.log(tabType, '633');
      // this.loadVisible = true
      // if (!this.addTabDrawerVisible) {
      //   this.tableData = []
      // }
      // let data = {
      //   "type": tabType
      // }
      // getProjectList(data).then(res => {
      //   if (res && res.status === 200) {
      //     if (res.data && res.data.data && res.data.data.length > 0) {
      //       let arr = res.data.data
      //       if (tabType === 'ALL') {
      //         this.projectPermissionDataOid = arr
      //       }
      //       this.getTableData(arr)
      //     } else {
      //       this.loadVisible = false
      //       this.tableData = []
      //     }
      //   } else {
      //     this.tableData = []
      //   }
      // });
      this.getTableData('ALL')
    },
    getTableData(key) {
      // getProjectCaches(paramsData).then(res => {
        // if (res.status === 200) {
          // if (res.data && res.data.length > 0) {
            // UNAVAILABLE-GREEN-RED-YELLOW
            let data = _.clone(listContent)
            
            let listData = []
            if (key === 'ALL' ) {
              listData = data
            } else if (key === 'MANAGER') {
              // for (let i = 0; i < 15; i++) {
              //   listData.push(listContent[Math.floor((Math.random()*40)+1)])
              // }
              // listData = listData.filter(v => {})
              listData = data.splice(1, 26)
            } else if (key === 'JOIN') {
              // listContent.forEach(v => {
              //   listData.push(listContent[Math.floor((Math.random()*40)+1)])
              //   if (listData.length > 8) return
              // })
              listData = data.splice(23, 35)
            }
            
            listData.map(item => {
              if (item.healthStatus === 'UNAVAILABLE') {
                item.healthStatusImg = this.healthStatusImgObj.gray
              } else if (item.healthStatus === 'GREEN') {
                item.healthStatusImg = this.healthStatusImgObj.green
              } else if (item.healthStatus === 'YELLOW') {
                item.healthStatusImg = this.healthStatusImgObj.yellow
              } else if (item.healthStatus === 'RED') {
                item.healthStatusImg = this.healthStatusImgObj.red
              }
              // 先全部转化为大写，然后再转化为小写(因为返回的字段中有全部是小写的情况)
              for (var key in item) {
                item[key.toUpperCase()] = item[key];
                delete (item[key]);
              }
            })
            listData.map(it => {
              // 先全部转化为大写，然后再转化为小写
              for (var key in it) {
                it[key.toLowerCase()] = it[key];
                delete (it[key]);
              }
            })
            // this.tableData = res.data
            this.tableData = _.orderBy(listData, ['createstamp'], ['desc'])//按照创建时间降序排序
            // this.searchData = _.orderBy(res.data, ['createstamp'], ['desc'])//按照创建时间降序排序
            // setTimeout(() => {
            //   this.$refs.globalSearch.onSearch()
            // }, 20)
            this.loadVisible = false
      //     } else {
      //       this.loadVisible = false
      //     }
      //   } else {
      //     this.searchData = []
      //     this.loadVisible = false
      //     this.$message.error('获取数据失败')
      //   }
      // }).catch(error => {
      //   this.searchData = []
      //   this.loadVisible = false
      //   this.$message.error('获取数据接口异常')
      // })

    },
    // 选中数据
    selectedRows(val) {
      this.hasSelectTableData = val
    },
    
    // 关注项目&取消关注
    attentionChange(type) {
      if (this.hasSelectTableData.length > 0) {
        let arr = []
        this.hasSelectTableData.map(item => {
          arr.push(item.oid)
        })
        let obj = arr.join(',')
        let data = {
          "attention": type,
          "projectList": obj,
          "userId": userInfo.loginName
        }
        let _t = this
        addAttentionData(data).then(res => {
          if (res.status === 200) {
            if (type) {
              _t.callback(_t.defaultTagId)
              _t.$refs.table.selectedRowKeys = [] // 讲选中的置空
              _t.hasSelectTableData = [] // 置空选择的数据
              _t.$message.success('关注成功')
            } else {
              _t.getAttentionData(_t.defaultTagId)
              _t.$refs.table.selectedRowKeys = [] // 讲选中的置空
              _t.hasSelectTableData = [] // 置空选择的数据
              _t.$message.success('取消关注成功')
            }
          }
        })
      } 
    },
    // 点击跳转
    routerPage(val) {
      sessionStorage.setItem("fromRouteName", "projectList")
      // 1.赋值
      if(val.projecttype === "软件开发项目"){
        sessionStorage.setItem("projectSmallType", val.projectsmalltype)
      }
      this.$store.commit("SETPAGETITLEOBJ", val);
      this.$store.commit('SET_CHANGEDATA',{table1:[],table2:[],table3:[],table4:[]})
      const projectObj = {
        projectName: val.projectname,
        projectType: val.projecttype
      }
      sessionStorage.setItem("ProjectObj", JSON.stringify(projectObj))
      sessionStorage.setItem("oid", val.oid);
      sessionStorage.setItem("porjectInfo", JSON.stringify(val));
      closeSingleTabs()
      // 2.跳转页面
      this.$router.push({
        path: "/single",
        query: {
          oid: val.oid
        }
      });
    },
    // 我的应用权限
    // getAppPermission() {
    //   let data = {
    //     "userId":userInfo.loginName,
    //     "number":"80",
    //     "oid":""
    //   }
    //   myAppPermission(data).then(res => {
    //     if (res && res.status === 200) {
    //       if (res.data && res.data.data && res.data.data.length > 0) {
    //         this.hasPermission = res.data.data[0].hasPermission
    //       }
    //     }
    //   })
    // },
    // 创建项目
    createProject() {
      if (this.hasPermission) {
        this.$router.push({
          path: "/projectManage/createProject"
        });
      } else {
        return
      }
      
    },
    // 设置临界值
    // setCritical() {
    //   if (this.hasPermission) {
    //     this.criticalValueVsisible = true
    //   } else {
    //     return
    //   }
    // },
    // submitCritical() {
    //   this.criticalValueVsisible = false
    // },
    // valueCancel() {
    //   this.criticalValueVsisible = false
    // }
  }
};
</script>
<style lang="less" scoped>
  @import "../../../less/projectManage/projectManage.less";
  .tableItem{
    /deep/ .ant-table-body{
      min-height: calc(100vh - 410px);
    }
    /deep/ .ant-table-placeholder{
      min-height: calc(100vh - 422px);
      margin-top: -420px;
      border: none;
    }
  }
</style>
<style scoped>
.addTabModel .topInput{
  margin-bottom: 20px;
}
.addTabModel .topInput .ant-input {
  margin-top: 10px;
}
.addTabModel .botInput .ant-input-search {
  margin-top: 10px;
}
</style>